/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package simsimframework.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import simsimframework.Chart;
import simsimframework.SaveType;
import simsimframework.SimsimframeworkPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Chart</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link simsimframework.impl.ChartImpl#getName <em>Name</em>}</li>
 *   <li>{@link simsimframework.impl.ChartImpl#getFramesPerSecond <em>Frames Per Second</em>}</li>
 *   <li>{@link simsimframework.impl.ChartImpl#getSave <em>Save</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ChartImpl extends EObjectImpl implements Chart {
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getFramesPerSecond() <em>Frames Per Second</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFramesPerSecond()
	 * @generated
	 * @ordered
	 */
	protected static final Double FRAMES_PER_SECOND_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getFramesPerSecond() <em>Frames Per Second</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFramesPerSecond()
	 * @generated
	 * @ordered
	 */
	protected Double framesPerSecond = FRAMES_PER_SECOND_EDEFAULT;

	/**
	 * The default value of the '{@link #getSave() <em>Save</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSave()
	 * @generated
	 * @ordered
	 */
	protected static final SaveType SAVE_EDEFAULT = SaveType.NONE;

	/**
	 * The cached value of the '{@link #getSave() <em>Save</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSave()
	 * @generated
	 * @ordered
	 */
	protected SaveType save = SAVE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ChartImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return SimsimframeworkPackage.Literals.CHART;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SimsimframeworkPackage.CHART__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Double getFramesPerSecond() {
		return framesPerSecond;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setFramesPerSecond(Double newFramesPerSecond) {
		Double oldFramesPerSecond = framesPerSecond;
		framesPerSecond = newFramesPerSecond;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SimsimframeworkPackage.CHART__FRAMES_PER_SECOND, oldFramesPerSecond, framesPerSecond));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SaveType getSave() {
		return save;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSave(SaveType newSave) {
		SaveType oldSave = save;
		save = newSave == null ? SAVE_EDEFAULT : newSave;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, SimsimframeworkPackage.CHART__SAVE, oldSave, save));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case SimsimframeworkPackage.CHART__NAME:
				return getName();
			case SimsimframeworkPackage.CHART__FRAMES_PER_SECOND:
				return getFramesPerSecond();
			case SimsimframeworkPackage.CHART__SAVE:
				return getSave();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case SimsimframeworkPackage.CHART__NAME:
				setName((String)newValue);
				return;
			case SimsimframeworkPackage.CHART__FRAMES_PER_SECOND:
				setFramesPerSecond((Double)newValue);
				return;
			case SimsimframeworkPackage.CHART__SAVE:
				setSave((SaveType)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case SimsimframeworkPackage.CHART__NAME:
				setName(NAME_EDEFAULT);
				return;
			case SimsimframeworkPackage.CHART__FRAMES_PER_SECOND:
				setFramesPerSecond(FRAMES_PER_SECOND_EDEFAULT);
				return;
			case SimsimframeworkPackage.CHART__SAVE:
				setSave(SAVE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case SimsimframeworkPackage.CHART__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case SimsimframeworkPackage.CHART__FRAMES_PER_SECOND:
				return FRAMES_PER_SECOND_EDEFAULT == null ? framesPerSecond != null : !FRAMES_PER_SECOND_EDEFAULT.equals(framesPerSecond);
			case SimsimframeworkPackage.CHART__SAVE:
				return save != SAVE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(", framesPerSecond: ");
		result.append(framesPerSecond);
		result.append(", save: ");
		result.append(save);
		result.append(')');
		return result.toString();
	}

} //ChartImpl
